package com.ruoyi.web.controller.kerServer;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.kepServer.aircompressor.domain.Aircompressor;
import com.ruoyi.kepServer.aircompressor.service.IAircompressorService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * kepserver空压机Controller
 *
 * @author ruoyi
 * @date 2024-11-05
 */
@RestController
@RequestMapping("/aircompressor/aircompressor")
public class AircompressorController extends BaseController
{
    @Autowired
    private IAircompressorService aircompressorService;

    /**
     * 查询kepserver空压机列表
     */
    @PreAuthorize("@ss.hasPermi('aircompressor:aircompressor:list')")
    @GetMapping("/list")
    public TableDataInfo list(Aircompressor aircompressor)
    {
        startPage();
        List<Aircompressor> list = aircompressorService.selectAircompressorList(aircompressor);
        return getDataTable(list);
    }

    /**
     * 查询kepserver空压机列表-空压机1
     * lqx
     */
    @PreAuthorize("@ss.hasPermi('aircompressor:aircompressor:list')")
    @GetMapping("/listAircompressor1")
    public List<Aircompressor> listAircompressor1(Aircompressor aircompressor)
    {
        List<Aircompressor> list = aircompressorService.selectAircompressorList(aircompressor);
        return list;
    }

    /**
     * 查询kepserver空压机列表-空压机2
     * lqx
     */
    @PreAuthorize("@ss.hasPermi('aircompressor:aircompressor:list')")
    @GetMapping("/listAircompressor2")
    public List<Aircompressor> listAircompressor2(Aircompressor aircompressor)
    {
        List<Aircompressor> list = aircompressorService.selectAircompressorList(aircompressor);
        return list;
    }

    /**
     * 查询kepserver空压机列表-空压机3
     * lqx
     */
    @PreAuthorize("@ss.hasPermi('aircompressor:aircompressor:list')")
    @GetMapping("/listAircompressor3")
    public List<Aircompressor> listAircompressor3(Aircompressor aircompressor)
    {
        List<Aircompressor> list = aircompressorService.selectAircompressorList(aircompressor);
        return list;
    }

    /**
     * 导出kepserver空压机列表
     */
    @PreAuthorize("@ss.hasPermi('aircompressor:aircompressor:export')")
    @Log(title = "kepserver空压机", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Aircompressor aircompressor)
    {
        List<Aircompressor> list = aircompressorService.selectAircompressorList(aircompressor);
        ExcelUtil<Aircompressor> util = new ExcelUtil<Aircompressor>(Aircompressor.class);
        util.exportExcel(response, list, "kepserver空压机数据");
    }

    /**
     * 获取kepserver空压机详细信息
     */
    @PreAuthorize("@ss.hasPermi('aircompressor:aircompressor:query')")
    @GetMapping(value = "/{tagName}")
    public AjaxResult getInfo(@PathVariable("tagName") String tagName)
    {
        return success(aircompressorService.selectAircompressorByTagName(tagName));
    }

    /**
     * 新增kepserver空压机
     */
    @PreAuthorize("@ss.hasPermi('aircompressor:aircompressor:add')")
    @Log(title = "kepserver空压机", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Aircompressor aircompressor)
    {
        return toAjax(aircompressorService.insertAircompressor(aircompressor));
    }

    /**
     * 修改kepserver空压机
     */
    @PreAuthorize("@ss.hasPermi('aircompressor:aircompressor:edit')")
    @Log(title = "kepserver空压机", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Aircompressor aircompressor)
    {
        return toAjax(aircompressorService.updateAircompressor(aircompressor));
    }

    /**
     * 删除kepserver空压机
     */
    @PreAuthorize("@ss.hasPermi('aircompressor:aircompressor:remove')")
    @Log(title = "kepserver空压机", businessType = BusinessType.DELETE)
	@DeleteMapping("/{tagNames}")
    public AjaxResult remove(@PathVariable String[] tagNames)
    {
        return toAjax(aircompressorService.deleteAircompressorByTagNames(tagNames));
    }


    /**
     * 大屏  压风机  电压、电流
     */
    @GetMapping("/getYfValueList")
    public List<Aircompressor> getYfValueList()
    {
        List<Aircompressor> list = aircompressorService.getYfValueList();
        return list;
    }


    /**
     * 大营大屏  压风机  电压、电流
     */
    @GetMapping("/getDyDpYfValueList")
    public List<Aircompressor> getDyDpYfValueList()
    {
        List<Aircompressor> list = aircompressorService.getDyDpYfValueList();
        return list;
    }


    /**
     * 苍海大屏  压风机  电压、电流
     */
    @GetMapping("/getChDpYfValueList")
    public List<Aircompressor> getChDpYfValueList()
    {
        List<Aircompressor> list = aircompressorService.getChDpYfValueList();
        return list;
    }
}
